---
id: function
title: 函数 常见优化方法  
---

- 闭包  
- 尾调用优化
- lazy parsing 懒解析 vS eager parsing 饥饿解析
- 利用Optimizejs优化初次加载时间
  https://github.com/nolanlawson/optimize-js

```js

export default () => {
  const add = (a , b) => a+b;
  const num1 = 1;
  const num2 = 2;
  add(num1, num2);
}
```

```js

export default () => {
  const add =( (a , b) => a+b);
  const num1 = 1;
  const num2 = 2;
  add(num1, num2);
}
```